using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_Vote_Log - 投票记录 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleVoteLog<T> :ModelBase<ArticleVoteLog> where T : ArticleVoteLog, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.RowId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return RowId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.RowId=dy.RowId;
           this.UserId=dy.UserId;
           this.ContentId=dy.ContentId;
           this.VoteId=dy.VoteId;
           this.OptionId=dy.OptionId;
           this.IP=dy.IP;
           this.SubmitTime=dy.SubmitTime;
           this.Contents=dy.Contents;
        } 

        #region 定义属性

     
         /// <summary>
        /// 流水号
        /// </summary>
        private String _RowId = "";
      
        /// <summary>
        /// 流水号
        /// </summary>
        public String RowId
        {
            get 
            {
              return   (this._RowId); 
            }

            set 
            {
                    _RowId= value;  
            }
        }
       
     
         /// <summary>
        /// 用户ID
        /// </summary>
        private String _UserId = "";
      
        /// <summary>
        /// 用户ID
        /// </summary>
        public String UserId
        {
            get 
            {
              return   (this._UserId); 
            }

            set 
            {
                    _UserId= value;  
            }
        }
       
     
         /// <summary>
        /// 内容ID
        /// </summary>
        private String _ContentId = "";
      
        /// <summary>
        /// 内容ID
        /// </summary>
        public String ContentId
        {
            get 
            {
              return   (this._ContentId); 
            }

            set 
            {
                    _ContentId= value;  
            }
        }
       
     
         /// <summary>
        /// 投票ID
        /// </summary>
        private String _VoteId = "";
      
        /// <summary>
        /// 投票ID
        /// </summary>
        public String VoteId
        {
            get 
            {
              return   (this._VoteId); 
            }

            set 
            {
                    _VoteId= value;  
            }
        }
       
     
         /// <summary>
        /// 选项ID
        /// </summary>
        private String _OptionId = "";
      
        /// <summary>
        /// 选项ID
        /// </summary>
        public String OptionId
        {
            get 
            {
              return   (this._OptionId); 
            }

            set 
            {
                    _OptionId= value;  
            }
        }
       
     
         /// <summary>
        /// 用户IP
        /// </summary>
        private String _IP = "";
      
        /// <summary>
        /// 用户IP
        /// </summary>
        public String IP
        {
            get 
            {
              return   (this._IP); 
            }

            set 
            {
                    _IP= value;  
            }
        }
       
     
         /// <summary>
        /// 投票时间
        /// </summary>
        private DateTime _SubmitTime =DateTime.MinValue;
      
        /// <summary>
        /// 投票时间
        /// </summary>
        public DateTime SubmitTime
        {
            get 
            {
              return   (this._SubmitTime); 
            }

            set 
            {
                    _SubmitTime= value;  
            }
        }
       
     
         /// <summary>
        /// 投票内容
        /// </summary>
        private String _Contents = "";
      
        /// <summary>
        /// 投票内容
        /// </summary>
        public String Contents
        {
            get 
            {
              return   (this._Contents); 
            }

            set 
            {
                    _Contents= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(ArticleVoteLog info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["RowId"]!= DBNull.Value)
                  {
                  info.RowId=row["RowId"].ToString();
                 }
                 
                  
                  if(row["UserId"]!= DBNull.Value)
                  {
                  info.UserId=row["UserId"].ToString();
                 }
                 
                  
                  if(row["ContentId"]!= DBNull.Value)
                  {
                  info.ContentId=row["ContentId"].ToString();
                 }
                 
                  
                  if(row["VoteId"]!= DBNull.Value)
                  {
                  info.VoteId=row["VoteId"].ToString();
                 }
                 
                  
                  if(row["OptionId"]!= DBNull.Value)
                  {
                  info.OptionId=row["OptionId"].ToString();
                 }
                 
                  
                  if(row["IP"]!= DBNull.Value)
                  {
                  info.IP=row["IP"].ToString();
                 }
                 
                  
                  if(row["SubmitTime"]!= DBNull.Value)
                  {
                  info.SubmitTime=Convert.ToDateTime(row["SubmitTime"]);
                 }
                 
                  
                  if(row["Contents"]!= DBNull.Value)
                  {
                  info.Contents=row["Contents"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleVoteLog info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@RowId", DbType.String,ParameterTool.GetObj( info._RowId )); 
            
             
                cn.AddInParameter(comm, "@UserId", DbType.String,ParameterTool.GetObj( info._UserId )); 
            
             
                cn.AddInParameter(comm, "@ContentId", DbType.String,ParameterTool.GetObj( info._ContentId )); 
            
             
                cn.AddInParameter(comm, "@VoteId", DbType.String,ParameterTool.GetObj( info._VoteId )); 
            
             
                cn.AddInParameter(comm, "@OptionId", DbType.String,ParameterTool.GetObj( info._OptionId )); 
            
             
                cn.AddInParameter(comm, "@IP", DbType.String,ParameterTool.GetObj( info._IP )); 
            
             
                cn.AddInParameter(comm, "@SubmitTime", DbType.DateTime,ParameterTool.GetObj( info._SubmitTime )); 
            
             
                cn.AddInParameter(comm, "@Contents", DbType.String,ParameterTool.GetObj( info._Contents )); 
            
        } 

    } 
} 